package edu.online.dal;

import edu.online.entity.PayInfoEntity;
import org.apache.ibatis.jdbc.SQL;

public class PayInfoEntitySqlProvider {

    public String insertSelective(PayInfoEntity record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("payinfo");
        
        if (record.getPayinfoid() != null) {
            sql.VALUES("PayInfoID", "#{payinfoid,jdbcType=CHAR}");
        }
        
        if (record.getStudentid() != null) {
            sql.VALUES("StudentId", "#{studentid,jdbcType=CHAR}");
        }
        
        if (record.getAdminuserid() != null) {
            sql.VALUES("AdminUserId", "#{adminuserid,jdbcType=CHAR}");
        }
        
        if (record.getPaymethod() != null) {
            sql.VALUES("PayMethod", "#{paymethod,jdbcType=VARCHAR}");
        }
        
        if (record.getPayamount() != null) {
            sql.VALUES("PayAmount", "#{payamount,jdbcType=INTEGER}");
        }
        
        if (record.getPayaccount() != null) {
            sql.VALUES("PayAccount", "#{payaccount,jdbcType=VARCHAR}");
        }
        
        if (record.getPaytime() != null) {
            sql.VALUES("PayTime", "#{paytime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getConfirmtime() != null) {
            sql.VALUES("ConfirmTime", "#{confirmtime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(PayInfoEntity record) {
        SQL sql = new SQL();
        sql.UPDATE("payinfo");
        
        if (record.getStudentid() != null) {
            sql.SET("StudentId = #{studentid,jdbcType=CHAR}");
        }
        
        if (record.getAdminuserid() != null) {
            sql.SET("AdminUserId = #{adminuserid,jdbcType=CHAR}");
        }
        
        if (record.getPaymethod() != null) {
            sql.SET("PayMethod = #{paymethod,jdbcType=VARCHAR}");
        }
        
        if (record.getPayamount() != null) {
            sql.SET("PayAmount = #{payamount,jdbcType=INTEGER}");
        }
        
        if (record.getPayaccount() != null) {
            sql.SET("PayAccount = #{payaccount,jdbcType=VARCHAR}");
        }
        
        if (record.getPaytime() != null) {
            sql.SET("PayTime = #{paytime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getConfirmtime() != null) {
            sql.SET("ConfirmTime = #{confirmtime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("PayInfoID = #{payinfoid,jdbcType=CHAR}");
        
        return sql.toString();
    }
}